package com.example.kliven.because.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.kliven.because.fragment.HomeFragment;
import com.example.kliven.because.fragment.HomePageAttentionFragment;
import com.example.kliven.because.fragment.HomePageShareFragment;

/**
 * Created by Kliven on 16/1/8.
 */
public class HomeTabAdapter extends FragmentPagerAdapter {
    public final static int TAB_COUNT = 2;
    public HomeTabAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case HomeFragment.TAB_SHARE:
                HomePageShareFragment shareFragment = new HomePageShareFragment();
                return shareFragment;
            case HomeFragment.TAB_COMMENT:
                HomePageAttentionFragment attentionFragment = new HomePageAttentionFragment();
                return attentionFragment;

        }
        return null;
    }

    @Override
    public int getCount() {
        return TAB_COUNT;
    }
}
